<?php
    $selected_region_setting = array(
        'table_name' => 'animus_sub_region',
        'key_field' => 'id',
        'value_field' => 'name',
        'init_data' => array('key'=>'','name'=>'Sélectionner')
    );
?>
<div id="wrapper-content">
     <div class="titre_home" >LISTE DES GARDIENS</div>
     <div id="recherche" align="right">
    <?php echo form_open('seatting_falin/search_gardient'); ?>
                <table >
                    <tr>
                        <td>Ville:</td>
                        <td><?php echo form_dropdown('search_city',dropdown_data($selected_region_setting),$selected_region,'style="width:150px;"')?></td>
                        <td><input type="submit" name="search" value=" Recherche " /></td>
                    </tr>
                </table>
    <?php echo form_close(); ?>
     </div>
    <?php if($total>0){ ?>
    <table width="90%" class="list">
        <thead>
            <tr>
                <th></th>
                <th>Nom complet</th>
                <th>Age</th>
                <th>Experience</th>
                <th colspan="3">Action</th>
            </tr>
        </thead>
<?php foreach ($query as $aRow): ?>
        <?php
            $date_patern = '%d/%m/%Y';
            $incrit = mdate($date_patern,$aRow['dob']);
            $birthday=$aRow['dob'];
            $now = time();
            $str = explode(',',timespan($birthday, $now));
            $dob = $str[0];

            $image_path = './assets/avatar_gardient/thumbs/' . $aRow['avatar'];
            if (file_exists($image_path) && $aRow['avatar']!=null) {
                $image_path = base_url() . 'assets/avatar_gardient/thumbs/' . $aRow['avatar'];
                $image_path_full = base_url() . 'assets/avatar_gardient/thumbs/' . $aRow['avatar'];
            } else {
                    $image_path = root_url('seatting-falin') . 'assets/noimage.gif';
                    $image_path_full = root_url('seatting-falin') . 'assets/noimage.gif';
            }
        ?>
                    <tr>
                        <td width="10%"><a href="<?php echo $image_path_full?>" id="example5" title=""><img border="0" src="<?php echo $image_path;?>" width="80px"/></a></td>
                        <td>
                            <div id="my_cell"><?php echo $aRow['gardient_name']; ?></div>
                        </td>
                        <td><?php echo $dob; ?></td>
                        <td><?php echo $aRow['experience'].' years'; ?></td>
                        <td width="70px">
                            <a  class="booking_button" href="<?php echo site_url('seatting_falin/booking_gardient') . '/' . $aRow['id'] ; ?>">Réserver</a>
                        </td>
                    </tr>
<?php endforeach; ?>
                </table>
     <div id="wrapper_page">
<?php echo $pagination; ?>
     </div>
    <?php }else{?>
    <div align="text">Aucun résultat</div>
    <?php }?>
</div>
<!--END wrapper-content-->
